package com.lsa.letcode.the14.longestCommon;


import org.junit.Assert;
import org.junit.Test;

public class LongestCommonPrefixTest {
	@Test
	public void test(){
		Solution s = new Solution();
		test(s, "abc", new String[]{"abc","abcd", "abcaaca", "abc","abcegfgd"});
		test(s, "ab", new String[]{"ab"});
		test(s, "a", new String[]{"aa","a"});
		test(s, "a", new String[]{"a","ab","abc","abcd"});
		test(s, "abcd", new String[]{"abcd","abcd","abcd","abcd"});
		test(s, "", new String[]{"a","bb","abc","abcd"});
		test(s, "", new String[]{"a","","abc","abcd"});
	}

	private void test(Solution s, String expected, String[] input) {
		String actual = s.longestCommonPrefix(input);
		Assert.assertEquals(expected, actual);
	}
}
